package org.phalanx.client.dialogs.servernode;

import java.awt.Color;
import java.awt.FlowLayout;

import javax.swing.JPanel;

import org.phalanx.client.UI.PhalanxIconButton;
import org.phalanx.client.UI.swing.PhalanxButtonFactory;
import org.phalanx.client.UI.swing.listeners.pButtonListener;
import org.phalanx.client.UI.swing.listeners.pButtonPressed;

public class PhalanxServerNodeNavPanel extends JPanel implements pButtonListener{
	ServerNodeConnectionPanel masterPanel;
	PhalanxIconButton mainMenu;
	
	public PhalanxServerNodeNavPanel(ServerNodeConnectionPanel parentPanel){
		this.masterPanel = parentPanel;
		initializePanel();
		setUpComponents();
		
		this.add(mainMenu);
	}
	
	private void initializePanel(){
		this.setBackground(Color.black);
		this.setLayout(new FlowLayout(FlowLayout.RIGHT));
	}
	
	private void setUpComponents(){
		mainMenu = PhalanxButtonFactory.getButton(PhalanxButtonFactory.NAV_MAIN_MENU_BUTTON);
		mainMenu.setForeground(Color.white);
		mainMenu.setText("Main Menu");
		
		mainMenu.addButtonListener(this);
	}

	public void actionPerformed(pButtonPressed p) {
		if (p.getComponent().equals(mainMenu)){
			masterPanel.switchToMainMenu(true);
		}
		
	}
	
}
